<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">

<head>
    <meta charset="UTF-8">
    <title>退砼处理</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <link rel="icon" th:href="@{/static/console/common/images/favicon.ico}">
    <link rel="stylesheet" type="text/css" th:href="@{/static/css/element/index.css}"/>
    <link rel="stylesheet" type="text/css"
          th:href="@{/static/console/css/production/component/invoice-select.css?version=202501071001}"/>
    <link rel="stylesheet" type="text/css"
          th:href="@{/static/console/css/production/invoice-back.css?version=202303231055}"/>
</head>

<body>
<div id="container">
    <el-container>
        <el-header>
            <el-date-picker v-model="tableSearch.startDate"
                            type="datetime" placeholder="起始日期"
                            :value-format="tableSearch.dateFormat">
            </el-date-picker>
            <el-date-picker v-model="tableSearch.endDate"
                            type="datetime" placeholder="截止日期"
                            :value-format="tableSearch.dateFormat">
            </el-date-picker>
            <el-input v-model="tableSearch.conName" placeholder="工程名称" clearable></el-input>
            <el-input v-model="tableSearch.site" placeholder="施工部位" clearable></el-input>
            <el-select v-model="tableSearch.handle" placeholder="是否处理" clearable>
                <el-option key="0" label="未处理" value="0"></el-option>
                <el-option key="1" label="已处理" value="1"></el-option>
            </el-select>
            <el-button type="success" icon="el-icon-search" @click="searchDatas">查询</el-button>
            <template th:if="${menuRole.isInsert == 1}">
                <el-button type="primary" icon="el-icon-plus" @click="showAddDialog">添加</el-button>
            </template>
        </el-header>
        <el-main>
            <el-table :data="tableDatas" border v-loading="tableLoading" max-height="750" size="mini">
                <el-table-column label="序号" type="index" fixed="left"
                                 width="50"></el-table-column>
                <el-table-column prop="sourceInvoiceCode" label="发货单编号" fixed="left"
                                 width="200"></el-table-column>
                <el-table-column prop="sourInvProTime" label="生产时间" fixed="left"
                                 width="150"></el-table-column>
                <el-table-column prop="weightTime" label="退砼过磅时间" fixed="left"
                                 width="150"></el-table-column>
                <el-table-column prop="conName" show-overflow-tooltip
                                 label="工程名称"
                                 width="210"></el-table-column>
                <el-table-column prop="site" show-overflow-tooltip
                                 label="施工部位"
                                 width="210"></el-table-column>
                <el-table-column prop="reTypeTxt" label="退料类型"
                                 width="80"></el-table-column>
                <el-table-column prop="strengthName" show-overflow-tooltip
                                 label="强度等级"
                                 width="120"></el-table-column>
                <el-table-column prop="slumps"
                                 label="塌落度"
                                 width="70"></el-table-column>
                <el-table-column prop="tech"
                                 label="特性要求"
                                 width="100"></el-table-column>
                <el-table-column label="车辆编号"
                                 width="160">
                    <template scope="scope">
                        {{scope.row.carCode}},{{scope.row.carNo}}
                    </template>
                </el-table-column>
                <el-table-column prop="weightStere"
                                 label="过磅方量(方)"
                                 width="120"></el-table-column>
                <el-table-column prop="backTranStere"
                                 label="处理方量(方)"
                                 width="120"></el-table-column>
                <el-table-column prop="backRemainStere"
                                 label="剩余方量(方)"
                                 width="120"></el-table-column>
                <el-table-column fixed="right"
                                 label="操作"
                                 width="280">
                    <template scope="scope">
                        <el-tooltip class="item" effect="dark" content="退砼单操作记录" placement="top">
                            <el-button icon="el-icon-s-operation" size="mini" type="info"
                                       @click="showRecordDialog(scope.row)"></el-button>
                        </el-tooltip>
                        <template th:if="${menuRole.isUpdate == 1}">
                            <el-button icon="el-icon-edit" size="mini" type="primary"
                                       @click="showEditDialog(scope.row)"></el-button>
                            <el-button icon="el-icon-sort" size="mini" type="primary"
                                       @click="showOperateDialog(scope.row)">
                                处理
                            </el-button>
                        </template>
                        <template th:if="${menuRole.isDelete == 1}">
                            <el-popconfirm title="确定删除该退砼单吗？" @confirm="deleteBack(scope.row.id)">
                                <el-button icon="el-icon-delete" size="mini" type="danger" slot="reference"></el-button>
                            </el-popconfirm>
                        </template>
                    </template>
                </el-table-column>
            </el-table>
            <el-pagination background
                           @size-change="handleSizeChange"
                           @current-change="handleCurrentChange"
                           :page-sizes="[50, 100, 200,500]"
                           :page-size="tableSearch.limit"
                           :current-page.sync="tableSearch.pageIndex"
                           layout="total,sizes, prev, pager, next"
                           :total="tableSearch.total">
            </el-pagination>
        </el-main>
    </el-container>
    <template>
        <!--  新增/修改退砼单  -->
        <el-dialog :title="invBackDialog.title" :visible.sync="invBackDialog.show" width="65%" center
                   v-loading="invBackDialog.loading" :close-on-click-modal="0" :show-close="0"
                   custom-class="invoice-back-dialog">
            <el-form label-position="right" label-width="140px" :inline="true" :model="invBackForm" ref="invBackForm"
                     :rules="invBackRules">
                <invoice-select @change="invoiceChange" v-if="invBackDialog.show"
                                :invoice-id="invBackForm.render.invoiceId"
                                :can-edit="invBackDialog.update"></invoice-select>
                <el-divider></el-divider>
                <el-form-item label="退料类型" required prop="render.reType">
                    <el-select v-model="invBackForm.render.reType" filterable placeholder="退料类型"
                               value-key="id" :disabled="invBackDialog.update == true">
                        <el-option v-for="item in backTypeList"
                                   :key="item.code"
                                   :label="item.desc"
                                   :value="item.code + ''">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="过磅退回方量" required prop="render.weightStere">
                    <el-input v-model="invBackForm.render.weightStere" type="number"></el-input>
                </el-form-item>
                <el-form-item label="退料时间" required prop="render.weightTime">
                    <el-date-picker v-model="invBackForm.render.weightTime" class="invoice-time"
                                    value-format="yyyy-MM-dd HH:mm:ss" type="datetime" placeholder="退料时间">
                    </el-date-picker>
                </el-form-item>
                <br>
                <el-form-item label="备注" class="invoice-remark">
                    <el-input type="textarea" :rows="2" v-model="invBackForm.render.remark"></el-input>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button type="primary" @click="saveBakData('invBackForm')">确定</el-button>
                <el-button @click="cancel('invBackForm','invBackDialog')">取 消</el-button>
            </div>
        </el-dialog>
    </template>
    <template>
        <!--  退砼处理  -->
        <el-dialog title="退砼处理" :visible.sync="operateDialog.show" width="65%" center
                   v-loading="operateDialog.loading" :close-on-click-modal="0" :show-close="0"
                   custom-class="back-operate-dialog">
            <el-form label-position="right" label-width="140px" :inline="true" :model="operateForm" ref="operateForm">
                <el-form-item label="处理类型" required>
                    <el-select v-model="operateForm.render.type" filterable placeholder="处理类型"
                               value-key="id">
                        <el-option v-for="item in backOperateList"
                                   :key="item.code"
                                   :label="item.desc"
                                   :value="item.code + ''">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item required label-width="auto">
                    <template slot="label">
                        操作方量(剩余
                        <el-tag type="danger">{{operateForm.exhibition.backRemainStere}}</el-tag>
                        )
                    </template>
                    <el-input v-model="operateForm.render.stere" type="number"></el-input>
                </el-form-item>
                <el-form-item label="原发货单是否累计" label-width="auto">
                    <el-radio-group v-model="operateForm.render.isAdd">
                        <el-radio label="0">累计</el-radio>
                        <el-radio label="1">不累计</el-radio>
                    </el-radio-group>
                </el-form-item>
                <br>
                <!--  如果是转料操作,需要选择发货单  -->
                <template v-if="operateForm.render.type != null && operateForm.render.type != 0">
                    <invoice-select @change="operateInvChange"></invoice-select>
                    <el-form-item label="新车发货方量" class="send-stere">
                        <el-input v-model="operateForm.render.sendStere"></el-input>
                    </el-form-item>
                </template>
                <el-form-item v-else label="作废原因" required>
                    <el-input v-model="operateForm.render.remark" type="textarea"></el-input>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button type="primary" @click="saveOperateData('operateForm')">确定</el-button>
                <el-button @click="cancel('operateForm','operateDialog')">取 消</el-button>
            </div>
        </el-dialog>
    </template>
    <template>
        <!--  退砼单操作记录  -->
        <el-dialog title="退砼单操作记录" :visible.sync="recordDialog.show" width="65%" center v-loading="recordDialog.loading"
                   :close-on-click-modal="0" custom-class="handle-record-dialog">
            <el-timeline v-if="recordList != null && recordList.length > 0">
                <template v-for="handleItem in recordList">
                    <el-timeline-item :timestamp="handleItem.createTime" placement="top">
                        <el-descriptions :title="handleItem.operateTypeTxt" direction="vertical" :column="7" border>
                            <el-descriptions-item label="处理类型">
                                <el-tag v-if="handleItem.operateType == 0" type="danger" size="mini">作废</el-tag>
                                <el-tag v-if="handleItem.operateType == 1" type="primary" size="mini">转料(本站)</el-tag>
                                <el-tag v-if="handleItem.operateType == 2" type="primary" size="mini">转料(其他站)</el-tag>
                            </el-descriptions-item>
                            <el-descriptions-item label="目标发货单">
                                {{handleItem.targetInvoiceCode}}
                            </el-descriptions-item>
                            <el-descriptions-item label="操作方量(方)">{{handleItem.operateStere}}</el-descriptions-item>
                            <el-descriptions-item label="操作人员">{{handleItem.creator}}</el-descriptions-item>
                            <el-descriptions-item label="操作时间">{{handleItem.createTime}}</el-descriptions-item>
                            <el-descriptions-item label="操作">
                                <template th:if="${menuRole.isDelete == 1}">
                                    <el-popconfirm title="确定删除该处理记录吗？"
                                                   @confirm="delHandle(handleItem.pid,handleItem.id)">
                                        <el-button icon="el-icon-delete" size="mini" type="danger"
                                                   slot="reference"></el-button>
                                    </el-popconfirm>
                                </template>
                            </el-descriptions-item>
                        </el-descriptions>
                    </el-timeline-item>
                </template>
            </el-timeline>
            <template v-if="recordList == null || recordList.length == 0">
                <el-empty :image-size="200"></el-empty>
            </template>
        </el-dialog>
    </template>
</div>
</body>
<script type="text/javascript" th:src="@{/static/console/assets/js/jquery-3.2.1.min.js}"></script>
<script type="text/javascript" th:src="@{/static/console/js/pages/base.js}" charset="utf-8"></script>
<script type="text/javascript" th:src="@{/static/js/vue.min.js}"></script>
<script type="text/javascript" th:src="@{/static/js/element/index.js}"></script>
<script type="text/javascript" th:src="@{/static/console/datepicker/jquery-datePicker.js}" charset="utf-8"></script>
<script th:src="@{/static/console/js/pages/production/component/invoice-select.js?version=202504031026}"></script>
<script type="text/javascript" th:src="@{/static/console/js/pages/production/invoice-back.js?version=202504031026}"
        charset="utf-8"></script>

</html>